package me.a_littlesquid.origin.events;

import me.a_littlesquid.origin.items.book;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;

public class bookuse implements Listener {
    @EventHandler
    public void onBookUse(PlayerInteractEvent event){
        Player player=event.getPlayer();
        if(event.hasItem()){
            ItemStack itemStack=event.getItem();
            ItemStack books= book.getbook();
            PlayerInventory playerInventory=player.getInventory();
            if (itemStack.equals(books)){
                playerInventory.remove(books);
                player.performCommand("origin set sj");
            }
        }
    }
}
